#!/usr/bin/env python
# -*- coding: utf-8 -*-
# title       :
# description :
# author      :
# mtine       :
# version     :
# usage       :
# notes       :

# Built-in modules

# Third-party modules


def getMayaWindow2():
    """
    Get the main Maya window as a QtGui.QMainWindow instance
    @return: QtGui.QMainWindow instance of the top level Maya windows
    """
    import Qt
    try:
        from PySide import QtGui
        import maya.OpenMayaUI as apiUI
        if Qt.__binding__ == 'PySide':
            from shiboken import wrapInstance
        elif Qt.__binding__ == 'PySide2':
            from shiboken2 import wrapInstance
        try:
            if wrapInstance.__str__() == '<built-in function wrapInstance>':
                ptr = apiUI.MQtUtil.mainWindow()
                if ptr is not None:
                    return wrapInstance(long(ptr), QtGui.QWidget)
        except:
            from Qt import QtWidgets
            for obj in QtWidgets.QApplication.topLevelWidgets():
                if obj.objectName() == 'MayaWindow':
                    return obj
    except:
        from pymel.core import toQtObject
        mayaWindow = toQtObject("MayaWindow")
        return mayaWindow

def getMayaWindow():
    from pymel.core import toQtObject
    mayaWindow = toQtObject("MayaWindow")
    return mayaWindow
            
if __name__ == "__main__":
    pass


